// 题目链接：https://leetcode.cn/problems/house-robber/

class Solution
{
public:
    int rob(vector<int> &nums)
    {
        size_t sz = nums.size();
        vector<int> money(sz + 2, 0);
        for (int i = nums.size() - 1; i >= 0; --i)
        {
            money[i] = max(money[i + 1], money[i + 2] + nums[i]);
        }

        return money[0];
    }
};